package com.example.demo.dao;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.domain.consignee;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class textcase {
    @Autowired
    private bookdao bod;
    @Test
    void textgetbyid(){
        System.out.println(bod.selectById(3));
    }
    @Test
    void textsave(){
        consignee con=new consignee();
        con.setCgnName("刘三");
        con.setCgnAddress("上海市招商局");
        con.setCgnTel("18855268746");
        con.setUserId(123);
        bod.insert(con);
        System.out.println("插入成功");
    }
    @Test
    void textupdata(){
        consignee con=new consignee();
        con.setId(14);
        con.setCgnName("布拉德皮特");
        con.setCgnAddress("上海市招商局");
        con.setCgnTel("18855268746");
        con.setUserId(123);
        bod.updateById(con);
        System.out.println("修改成功");
    }
    @Test
    void textdelect(){
    bod.deleteById(14);
        System.out.println("删除成功");
    }
    @Test
    void textall(){
        System.out.println(bod.selectList(null));
    }
    @Test
    void textfen(){
        IPage page=new Page(2,5);
    bod.selectPage(page,null);
    }
    @Test
    void textallby(){
        QueryWrapper<consignee> qw=new QueryWrapper<>();
        qw.like("cgn_address","西");
//        eq等于 ne不等于 lt 大于 gt小于
        bod.selectList(qw);
    }
}
